package org.snail.attendence.mapper;

import org.snail.attendence.bean.*;
import org.snail.base.AttendenceCondition;
import org.snail.du.bean.DUDO;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface AttendenceMapper {
    void insertCommonList(List<AttendenceCommonDO> AttendenceCommonDOs);
    void insertCountList(List<AttendenceCountDO> attendenceCountDO);
    List<AttendanceCheckDO> findAttendanceCheck(AttendanceCondition attendanceCondition);
    List<AttendanceCheckDO> findAttendanceCount(AttendanceCondition attendanceCondition);
    List<Map<String, Object>> findAttendanceDates(AttendanceCondition attendanceCondition);
    List<AttendanceCheckDO> findAttendanceDetail(AttendanceCondition attendanceCondition);

    /**
     * 保存不可调休工作日 周末 法定节假日
     * @param attendanceCheckDO
     * @return
     */
    Integer findCommIdByEmpId(AttendanceCheckDO attendanceCheckDO);
    Integer findCountIdByCommId(AttendanceCondition attendanceCondition);
    void saveAttendanceDetail(AttendanceCheckDO attendanceCheckDO);

    //查询考勤信息 为了做预览页面
    List<AttendenceCommonDO> findAllAttendenceCommon();

    /**
     * 考勤核算查询
     * 提供AttendenceCommonDO 查询对应的AttendenceCount
     * @param attendenceCommonDO
     * @return
     */
    AttendenceCountDO findAttendenceCount(AttendenceCommonDO attendenceCommonDO);

    /**
     * 条件查询钉钉考勤信息
     * @param attendenceCondition
     * @return
     */
    List<AttendenceCommonDO> findAttendenceCommonByCondition(AttendenceCondition attendenceCondition);

    List<AliWorkDTO> findAttendenceByCondition(AliWorkDTO aliWorkDTO);

    List<AttendenceCommonDO> exhibitionAttendanceByCondition(AttendanceCondition attendenceCondition);

    String searchLastMonth();

    /**
     * 保存异常考勤到数据库
     * @param abnormalAttendanceDTOs
     */
    void insertAttendenceAbnormal(List<AbnormalAttendanceDTO> abnormalAttendanceDTOs);

    /**
     * 跟新异常考勤
     * @param abnormalAttendanceDTOs
     */
    void updateAbnormalList(List<AbnormalAttendanceDTO> abnormalAttendanceDTOs);

    /**
     * 查询异常考勤
     * @return
     */
    List<AbnormalAttendanceDTO> findAllAbNormal(AttendanceCondition attendanceCondition);

    /**
     * 保存正常考勤到数据库
     * @param aliWorkDTOs
     */
    void insertAttendenceNormal(List<AliWorkDTO> aliWorkDTOs);

    /**
     * 跟新正常考勤数据
     * @param aliWorkDTOs
     */
    void updateNormalList(List<AliWorkDTO> aliWorkDTOs);

    /**
     * 查询正常考勤
     * @return
     */
    List<AliWorkDTO> findAllNormal(AttendanceCondition attendanceCondition);
    /**
     * 根据考勤id批量跟新考勤comm表
     * @param attendenceCommonDOList
     */
    void updateCommonList(List<AttendenceCommonDO> attendenceCommonDOList);

    /**
     * 根据考勤id批量跟新考勤count表
     * @param attendenceCountDOList
     */
    void updateCountList(List<AttendenceCountDO> attendenceCountDOList);
}